package com.css.dzj.zfjg.modules.clue.mapper;

import com.css.dzj.zfjg.modules.clue.entity.Clue;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 信用线索企业详情Mapper
 */
@Repository
public interface ClueMapper extends JpaRepository<Clue, String>, JpaSpecificationExecutor<Clue>,
        QuerydslPredicateExecutor<Clue> {


    /**
     * 查询信用线索企业详情(按照时间的降序下载)
     * nativeQuery = true:标志着为sql语句
     * @return
     */
    @Query(value = "select n.Enterprise_Name 企业名称,n.Enterprise_Id_Type 企业证件类型,n.Enterprise_Id_Number 企业证件号码, \n" +
            "n.Credit_clue_reasons 信用线索原因,n.Evaluation_Date 评估日期, n.Status 信用线索评估状态 \n"+
            "from DZJZFJG.JG_XYJG_XYXSQYXQ n \n" +
            "order by n.Create_Time DESC",nativeQuery = true)
    public List<Map> getAll();
}
